/**
 * Created by Administrator on 2017/9/2 0002.
 */
import React from 'react';
import { connect } from 'react-redux';
import '../style/pickApple.scss';
import {SubmitSingle} from '../../../actions/addAddress';

 export  class AppleBusket extends React.Component {
    constructor(props) {
        super(props);
    }
    handlePickApple () {
        let test=1;
        this.props.dispatch(SubmitSingle(test));
    };

    render(){
        return (
            <div className="appleBusket">
                <h1>{this.props.valueTest.test || 0}</h1>
                <div className="title">苹果篮子</div>

                <div className="stats">
                    <div className="section">
                        <div className="head">当前</div>
                        <div className="content">0个苹果，0克</div>
                    </div>
                    <div className="section">
                        <div className="head">已吃掉</div>
                        <div className="content">2个苹果，480克</div>
                    </div>
                </div>

                <div className="appleList">
                    <div className="empty-tip">苹果篮子空空如也</div>
                </div>

                <div className="btn-div">
                    <button onClick={this.handlePickApple.bind(this)}>摘苹果</button>
                </div>

            </div>
        );
    }

}
function mapStateToProps(state = {}) {
    console.log('..................', state);
    return {
        valueTest: state.testRedux
    };
}

export let ffff= connect(mapStateToProps)(AppleBusket);
